package com.icangya.weixin.sdk;
import com.icangya.Value.StaticValue;

import java.io.*;

public class MyConfig extends WXPayConfig {

    private byte[] certData;

    public MyConfig() throws Exception {
        String certPath = "/data/project/bigturntable/WEB-INF/classes/apiclient_cert.p12";
        File file = new File(certPath);
        InputStream certStream = new FileInputStream(file);
        this.certData = new byte[(int) file.length()];
        certStream.read(this.certData);
        certStream.close();
    }

    public String getAppID() {
        return StaticValue.WX.AppId;
    }

    public String getMchID() {

        return StaticValue.WX.MH_ID;
    }

//    public String getKey() {
//        return "b3c1f6cb16270661b792d9f6ac945b0b";
//    }

    public String getKey(){
        return StaticValue.WX.APP_KEY;
    }

    public InputStream getCertStream() {
        ByteArrayInputStream certBis = new ByteArrayInputStream(this.certData);
        return certBis;
    }

    public int getHttpConnectTimeoutMs() {
        return 8000;
    }

    public int getHttpReadTimeoutMs() {
        return 10000;
    }

    @Override
    IWXPayDomain getWXPayDomain() {
        return WXPayDomainSimpleImpl.instance();
    }
}